package com.chenjinyan;

import org.apache.catalina.authenticator.jaspic.AuthConfigFactoryImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
//import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
import org.springframework.context.annotation.Bean;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import javax.security.auth.message.config.AuthConfigFactory;

/**
 * @author chenjinyan
 * @version v1.0
 */
@SpringBootApplication
//@EnableEurekaClient
public class LostAndFindUserApplication {
    @Bean
    public BCryptPasswordEncoder bCryptPasswordEncoder() {
        return new BCryptPasswordEncoder();
    }

    public static void main(String[] args) {
        /**
         * 不加上下面这个if判断的话，在IDE中运行没有问题；但是如果打成jar包，通过bat文件启动，会报一个null异常
         */
        if (AuthConfigFactory.getFactory() == null) {
            AuthConfigFactory.setFactory(new AuthConfigFactoryImpl());
        }
        SpringApplication.run(LostAndFindUserApplication.class, args);

    }
}
